(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Scripts/Fruit.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '365b4UAiQRBA7QXa2IuFMmj', 'Fruit', __filename);
// scripts/Fruit.js

'use strict';

cc.Class({
    extends: cc.Component,

    properties: {
        id: 0,
        spf: cc.SpriteFrame
    },

    init: function init(data) {
        this.id = data.id;
        var sp = this.node.getComponent(cc.Sprite);
        sp.spriteFrame = data.iconSF;
        // todo 控制一下每种水果的尺寸

        //拖尾宽度重新计算
        var ms = this.node.getChildByName("tuowei").getComponent(cc.MotionStreak);
        ms.stroke = this.node.width * 2 / 3;
    },
    start: function start() {},
    resetSprite: function resetSprite() {
        var sp = this.node.getComponent(cc.Sprite);
        sp.spriteFrame = this.spf;
    },
    onBeginContact: function onBeginContact(contact, self, other) {
        // 貌似检测有点消耗性能
        if (self.node && other.node) {
            var s = self.node.getComponent('Fruit');
            var o = other.node.getComponent('Fruit');
            if (s && o) {
                if (self.node.getChildByName("wanneng").active == true) {
                    self.node.emit('sameContact', { self: self, other: other });
                } else {
                    if (s.id === o.id) {
                        self.node.emit('sameContact', { self: self, other: other });
                    }
                }
            }
        }
    }
});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=Fruit.js.map
        